home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / killdebug / RCS / killdebug,v < prev    next >
Encoding:
Text File  |  1992-04-23  |  2.3 KB  |  135 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    shirriff:1.4; strict;
  6. comment  @# @;
  7.  
  8.  
  9. 1.4
  10. date     92.04.23.12.33.00;  author shirriff;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     92.04.23.12.13.40;  author jhh;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     89.11.27.10.56.04;  author shirriff;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     89.08.16.17.14.20;  author shirriff;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @Initial program.
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @Changed it to kill all debug processes if you're root.
  38. @
  39. text
  40. @#! /sprite/cmds/perl
  41. #
  42. #  This is a Perl script that kills off all processes in the DEBUG state.
  43. #
  44. # $Header: /sprite/lib/forms/RCS/proto.csh,v 1.3 90/02/20 17:10:35 douglis Exp $ SPRITE (Berkeley)
  45. #
  46. # Copyright 1990 Regents of the University of California
  47. # Permission to use, copy, modify, and distribute this
  48. # software and its documentation for any purpose and without
  49. # fee is hereby granted, provided that the above copyright
  50. # notice appear in all copies.  The University of California
  51. # makes no representations about the suitability of this
  52. # software for any purpose.  It is provided "as is" without
  53. # express or implied warranty.
  54. #
  55. #
  56.  
  57. #
  58. # See if we're root
  59. #
  60. $user = `whoami`;
  61. chop($user);
  62.  
  63. #
  64. # Read output of "ps -d".
  65. #
  66. if ($user eq "root") {
  67.     open(input, "ps -ad |") || print("Open failed: $!\n");
  68. } else {
  69.     open(input, "ps -d |") || print("Open failed: $!\n");
  70. }
  71.  
  72. #
  73. # Get rid of header.
  74. #
  75. <input>;
  76.  
  77.  
  78. while(<input>) {
  79.     ($f1) = split(' ');
  80.     $goners[$#goners + 1] = hex($f1);
  81.     $pids[$#pids + 1] = $f1;
  82. }
  83.  
  84. if ($#goners >= 0) {
  85.     printf("%s\n", join(' ', @@pids));
  86.     #
  87.     # Give them a chance to die nicely.
  88.     #
  89.     kill ("TERM", @@goners) || print("Kill failed: $!\n");
  90.     #
  91.     # Finish them off.
  92.     #
  93.     kill ("KILL", @@goners) || print("Kill failed: $!\n");
  94. }
  95. @
  96.  
  97.  
  98. 1.3
  99. log
  100. @(Checked in by shirriff)
  101. @
  102. text
  103. @d19 6
  104. d27 5
  105. a31 1
  106. open(input, "ps -d |") || print("Open failed: $!\n");
  107. @
  108.  
  109.  
  110. 1.2
  111. log
  112. @Fixed bug preventing processes with pids < 5 digits being killed.
  113. @
  114. text
  115. @d1 45
  116. a45 6
  117. #! /bin/csh -f
  118. # This is a script to kill any processes in the debugger
  119. # Ken Shirriff  Aug/89
  120. set i = ( `ps -d | tail +2 | sed -e "s/^  *//" | sed -e "s/ *//" | sed -e "s/ .*//" `)
  121. echo $i
  122. kill -KILL $i >& /dev/null
  123. @
  124.  
  125.  
  126. 1.1
  127. log
  128. @Initial revision
  129. @
  130. text
  131. @d4 1
  132. a4 1
  133. set i = ( `ps -d | tail +2 | sed -e "s/ *//" | sed -e "s/ .*//" `)
  134. @
  135.